package com.test;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/****
 * 设置一个全局的name
 * http://localhost:8080/servlet-demo/servletContextDemo2
 */
@WebServlet(value="/servletContextDemo2")
public class ServletContextDemo2  extends HttpServlet{

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		 req.getServletContext().setAttribute("user", "zhangsan");
	}
}
